<?php
include_once "header.php";


if(isset($_GET["id_ars"]) && isset($_GET["kd_sk"])){
	
	$kd_sk = $_GET["kd_sk"];
	
	$daftar_arsip = new Daftar_arsip();
	$arsip_sk = $daftar_arsip->getArsipSKById($_GET["id_ars"]);
}

$cek_field="";

if (ISSET($_POST["ubah_arsip_sk"])){

	if($_POST['lokasi']=="" || $_POST['tgl']==""){
		
		$cek_field = "Peringatan: Silahkan isikan seluruh data yang tersedia.";
	
	} else {
		$daftar_arsip = new Daftar_arsip();
		$arsip = new Arsip();
		$arsip->setId($_POST["kd_ars"]);
		$arsip->setLokasi($_POST["lokasi"]);
		$arsip->setTgl_pengarsipan($_POST["tgl"]);
		
		$daftar_arsip-> editArsipSK($arsip);
		//var_dump($posisi_sk);
		header("Location:detil_sk.php?id=".$_POST["id"]."");
		}
	
}
?>

<div id="container">
	<div id="errorcont">
		<?php echo $cek_field;
		?>
	</div>
	<div id="maincont">
		<?php include_once "menu_samping.php"; ?>
		<div id="mainright">
			<div id="title">
			Surat Masuk > Detil > Ubah Tindaklanjut
			</div>
			<div id="body">
			</br>
			<form name="form1" method="POST" action="ubah_arsip_sk.php?id_ars=<?php echo $_GET["id_ars"]; ?>&&kd_sk=<?php echo $_GET["kd_sk"]; ?>">
			<input type="hidden" name="ubah_arsip_sk">
			<input type="hidden" name="id" value="<?php echo $kd_sk; ?>">
			<input type="hidden" name="kd_ars" value="<?php echo $_GET["id_ars"]; ?>">
			<table border=0 cellspacing=0 cellpadding=4 width=100%>		
				<tr>	
					<td>lokasi</td>
					<td>:</td>
					<td><textarea name="lokasi" cols=75 rows=2 ><?php echo $arsip_sk->getLokasi() ?></textarea></td>
				</tr>
				<tr>
					<td>Tanggal Pengarsipan</td>
					<td>:</td>
					<td>
					<input type="text" name="tgl" id="tgl" value="<?php echo $arsip_sk->getTgl_pengarsipan() ?>">
					</td>
				</tr>
								
			</table>
			<br>
			<input type="submit" value="Simpan"> 
			<input type="button" value="Batal" onClick="window.location.href='detil_sk.php?id=<?php echo $kd_sk; ?>'">
			</form>
						
			</div>
        </div>
	</div>
</div>
<?php
	include_once "footer.php";
?>

<script type="text/javascript">
	$(function() { 
	$("#tgl").datepicker({dateFormat: "yy-mm-dd",
											buttonImage:'jquery/css/images/calendar.gif',
											buttonImageOnly: true,
											showOn: 'button'
	}); 
	});
</script>

